package com.example.rbac.aop;

import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Component
@Aspect
//实现Ordered接口用于设置切面方法的执行优先级(定义优先级,值越低,优先级越高)
public class ExceptionAop implements Ordered{

    private static final Logger log = LoggerFactory.getLogger(ExceptionAop.class);

//    @Pointcut("execution(public * com.example.rbac.service..*(..))")
//    private void pointCutName(){}
//
//    @AfterThrowing(value = "pointCutName()", throwing = "e")
//    private void afterThrowable(Throwable e){
//        log.error(e.getMessage());
//    }

    @Override
    public int getOrder() {
        return 0;
    }
}
